window: Replace GtkStyleContext use to get surface transform
authorTimm Bäder <mail@baedert.org>
Fri, 24 Jan 2020 06:55:17 +0000 (07:55 +0100)
committerTimm Bäder <mail@baedert.org>
Sun, 26 Jan 2020 17:21:07 +0000 (18:21 +0100)
We have GtkCssBoxes for this these days.

gtk/gtkwindow.c

index dbdff2952641f6838f1db74d0f9a829df29f56b3..e7dd97fc00572ca56fa23c1db12dee4aaacf270b 100644 (file)
@@ -68,6 +68,7 @@
 #include "gtkwidgetprivate.h"
 #include "gtkwindowgroup.h"
 #include "gtkpopovermenubarprivate.h"
+#include "gtkcssboxesimplprivate.h"
 
 #include "a11y/gtkwindowaccessibleprivate.h"
 #include "a11y/gtkcontaineraccessibleprivate.h"
@@ -2354,17 +2355,14 @@ gtk_window_native_get_surface_transform (GtkNative *native,
                                          int       *x,
                                          int       *y)
 {
-  GtkWindow *self = GTK_WINDOW (native);
-  GtkStyleContext *context;
-  GtkBorder margin, border, padding;
+  const graphene_rect_t *margin_rect;
+  GtkCssBoxes boxes;
 
-  context = gtk_widget_get_style_context (GTK_WIDGET (self));
-  gtk_style_context_get_margin (context, &margin);
-  gtk_style_context_get_border (context, &border);
-  gtk_style_context_get_padding (context, &padding);
+  gtk_css_boxes_init (&boxes, GTK_WIDGET (native));
+  margin_rect = gtk_css_boxes_get_margin_rect (&boxes);
 
-  *x = margin.left + border.left + padding.left;
-  *y = margin.top + border.top + padding.top;
+  *x = - margin_rect->origin.x;
+  *y = - margin_rect->origin.y;
 }
 
 static void